#!/usr/bin/env python
import rospy
import tf
import sys
import time

def listener():
    rospy.init_node('listener', anonymous = True)
    prev = rospy.get_time()
    time.sleep(1)
    while not rospy.is_shutdown(): 
        print(str(prev)+': RUNNING')
        try:
            cur = rospy.get_time()
        except(tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
            continue
        if prev == cur:
            print('end')
            sys.exit(0)
        prev = cur  
        time.sleep(2) 
if __name__ == '__main__':
    listener()
